<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>5-原型对象的this指向</title>
	</head>
	<body>
		<script type="text/javascript">
			/**
			 * @param {Object} brand
			 * @param {Object} price
			 */
			function Mobile(brand,price){
				this.brand = brand;
				this.price = price;
			}
			
			//原型对象上挂载一个方法
			var _this;
			Mobile.prototype.sendmsg=function(){
				console.log(this);
				_this = this;
				console.log('发短信...');
			}
			
			//实例化
			var hw = new Mobile('华为p50',2999);
			hw.sendmsg();
			console.log(hw===_this);//true
		</script>
	</body>
</html>